<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        font-size: 28px;
      }
    </style>
  </head>

  <body>
    ifr.html
    <div>
      <div>Message:</div>
      <div id="messages"></div>
    </div>
    <script>
      window.addEventListener("message", function (event) {
        messages.innerHTML += `
                <div>${event.data}</div>  
            `;
      });

      setInterval(() => {
        window.parent.postMessage(`message from ifr.html: ${Date.now()}`);
      }, 2000);
    </script>
  </body>
</html>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
</html>
